package hc.bre.clas.range

import hc.bre.ComponentConfig
import hc.bre.clas.ClasRuleDefinition
import hc.bre.cmn.ListOption
import hc.bre.cmn.RuleScriptBuilder
import hc.bre.flow.FlowDefinition
import hc.bre.cmn.RuleDefinition

@groovy.transform.CompileStatic
@groovy.transform.ToString(includeNames=true,includePackage=false)
class RangeDefinition extends ClasRuleDefinition<RangeOption>{
	public static final ComponentConfig _config ;
	static {
		_config = new ComponentConfig();
		_config.rtype = 'rule:clas:range';
		_config.rname = '数值范围分类';
		_config.builderClass = RangeBuilder;
		_config.resultStruct = new hc.bre.clas.ClasResultStruct();
		_config.objectpage = '/rule/clas/RangeEditor.htm?rpath=${rpath}';
		_config.description = '''基于特征变量所归属的数值区间进行分类。''';
	}

	public static RangeDefinition create() {
		def ruleDef = new RangeDefinition();
		ruleDef.list = [
			new RangeOption().load([id:0,code:'other',name:'其它',range:'{true}',otherflag:1])
		];
		return ruleDef;
	}

	Integer variableId;

	@Override
	public RangeDefinition load(Map map) {
		super.load(map);
		variableId = map['variableId'] as Integer;
		return this;
	}
}
